SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE [dbo].[spValoresDeCESIDA]
@Tabla Varchar(50),
@ColumnaAExtraer Varchar(50),
@ColumnaAComparar Varchar(50),
@ValorAComparar Varchar(5)
AS
SET NOCOUNT ON
Declare @Retornar Int
Declare @Query Varchar(1000)

Select @Query = 'DECLARE @RETORNAR INT '+Char(10)
Select @Query = @Query + ' SELECT @RETORNAR = ' + @ColumnaAExtraer + ' From ' + @Tabla + ' Where ' + @ColumnaAComparar + ' = ' + @ValorAComparar + Char(10)

EXEC(@Query)

Return(@Retornar)
GO
